-module(test).
-export([tests/1]).

tests([N]) ->
	Nsched = list_to_integer(atom_to_list(N)),
	run_tests(1, Nsched).

run_tests(N, Nsched) ->
	case test(N,Nsched) of
		stop ->
			init:stop();
		Val ->
			io:format("~p.~n" ,[{Nsched, Val}]),
			run_tests(N+1, Nsched)
	end.

test(1,Nsched)->
	search(test1, "../tst/500.20", "../tst/result_500.20", Nsched);
test(2,Nsched)->
	search(test2, "../tst/1000.10", "../tst/result_1000.10", Nsched);
test(3,Nsched)->
	search(test3, "../tst/1500.15", "../tst/result_1500.15", Nsched);
test(4,Nsched)->
	search(test4, "../tst/2000.10", "../tst/result_2000.10", Nsched);
test(5,Nsched)->
	search(test5, "../tst/2000.20", "../tst/result_2000.20", Nsched);
test(6,_) ->
	stop.

search(Test, FileName, Res, Nsched) ->
	G = io_graph:load_graph({binary, FileName}),
	{ok, FileId} = file:open(Res, [write]),
	{ok, FileId2} = file:open("tmp.txt", [write]),
    {Time1, _} = timer:tc(pclique, pcliques, [G, Nsched, FileId2]),
	{Time2, _} = timer:tc(clique, cliques, [G, FileId]),
	{search, Test, Time1, Time2}.
    
